include ./common.mk

LFLAGS = `pkg-config --libs $(PKGS)`

infowall: infowall.c infowall.h cjson.o renderers/renderers.a pollers/pollers.a
	$(CC) $(CFLAGS) $(LFLAGS) infowall.c -o infowall cjson.o ./renderers/renderers.a ./pollers/pollers.a -lm

cjson.o: cJSON.c cJSON.h
	$(CC) -c cJSON.c -o cjson.o

.PHONY: clean debug leakcheck renderers/renderers.a pollers/pollers.a

run: infowall
	./infowall -w

debug: infowall
	gdb --args infowall -w

clean:
	rm -f infowall *.o
	$(MAKE) -C renderers clean
	$(MAKE) -C pollers clean

leakcheck: infowall
	valgrind --tool=memcheck --leak-check=full ./infowall -w

renderers/renderers.a:
	$(MAKE) -C renderers

pollers/pollers.a:
	$(MAKE) -C pollers
